package com.ruijie.acl.web.config;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.util.CollectionUtils;

import com.ruijie.batch.task.def.ItemParametersHandler;

/**
 * <p>Title: 软件下发计划参数处理器 </p>
 * <p>Description: Function Description </p>
 * <p>Copyright: Copyright (c) 2008     </p>
 * <p>Company: Ruijie Co., Ltd.       </p>
 * <p>Create Time: Dec 8, 2008           </p>
 * @author lusl
 * <p>Update Time:                      </p>
 * <p>Updater:                          </p>
 * <p>Update Comments:                  </p>
 */
public class AclDeployParametersHandler implements ItemParametersHandler {

    @SuppressWarnings("unchecked")
    public void populateUIModeles(List itemes, Map<Long, Object> uiModeles) {
        // nothing to do

    }

    @SuppressWarnings("unchecked")
    public Map<Long, Object> prepareItemParametersModel(Collection planItemParameters) {
        // plan --> ui
        return null;
    }

    @SuppressWarnings("unchecked")
    public void resolveItemParametersModel(Collection planItemParameters, Map<Long, Object> uiModeles) {
        // ui --> plan
        if (CollectionUtils.isEmpty(uiModeles)){
            return;
        }
        
//        for (Iterator it = uiModeles.keySet().iterator(); it.hasNext();) {
//            Long deviceId = (Long) it.next();
//            ItemInfo itemInfo = (ItemInfo) uiModeles.get(deviceId);
//            Long softwareId = itemInfo.getDeviceSoftware().getId();
//
//            if (!canInclude(itemInfo) || null == softwareId)
//                continue;
//
//            ItemParameters itemParameters = new ItemParameters();
//            itemParameters.setItem(deviceId);
//
//            itemParameters.putParameter("softwareId", String.valueOf(softwareId));
//
//            Object[] p = new Object[2];
//            p[0] = deviceId;
//            p[1] = itemParameters;
//
//            planItemParameters.add(p);
//        }

    }

    /**	
     * <p>Description: 检测itemInfo对应的设备能否被包含计划中 </p>
     * <p>Create Time: 2008-12-10   </p>
     * @author lusl
     * @param itemInfo
     * @return 若为true则可以被包含，为false则可以不可以被包含
     */
    //private boolean canInclude(ItemInfo itemInfo) {
    //	return true;
       // return itemInfo.getVersionCheck() == CheckState.PASS;
    //}

}
